import 'package:fluro/fluro.dart';
import 'package:hao_ke/pages/chat/chat.dart';
import 'package:hao_ke/pages/home/index.dart';
import 'package:hao_ke/pages/home/order_index.dart';
import 'package:hao_ke/pages/info/info_page.dart';
import 'package:hao_ke/pages/info/project-employee.dart';
import 'package:hao_ke/pages/loading.dart';
import 'package:hao_ke/pages/login.dart';
import 'package:hao_ke/pages/my/my.dart';
import 'package:hao_ke/pages/not_found_page.dart';
import 'package:hao_ke/pages/order/add_project.dart';
import 'package:hao_ke/pages/register.dart';
import 'package:hao_ke/pages/room/room.dart';

import '../pages/info/info_details.dart';

class Routes {
  static String home = '/';
  static String login = '/login';
  static String add = '/add';
  static String chat = '/chat';
  static String register = '/register';
  static String roomDetails = '/room/:roomId';
  static String infoDetails = '/project/:pkid';
  static String projectEmployee = '/project-employee/:pkid';
  static String infoPage = '/project';
  static String my = '/my';
  static String loading = '/loading';
  static String order = '/order';

  static Handler _homeHandler = Handler(handlerFunc: (context,params) {
    return HomePage();
  });

  static Handler _loginHandler = Handler(handlerFunc: (context,params) {
    return LoginPage();
  });
  static Handler _registerHandler = Handler(handlerFunc: (context,params) {
    return RegisterPage();
  });
  static Handler _myHandler = Handler(handlerFunc: (context,params) {
    return My();
  });

  static Handler _loadingHandler = Handler(handlerFunc: (context,params) {
    return Loading();
  });
  
  static Handler _notFoundHandler = Handler(handlerFunc: (context,params) {
    return NotFoundPage();
  });

  static Handler _addHandler = Handler(handlerFunc: (context,params) {
    return AddProject();
  });

  static Handler _infoHandler = Handler(handlerFunc: (context,params) {
    return InfoPage();
  });

  static Handler _projectEmployeeHandler = Handler(handlerFunc: (context,params) {
    return ProjectEmployee(params['pkid']![0]);
  });

  static Handler _chatHandler = Handler(handlerFunc: (context,params) {
    return Chat();
  });
  static Handler _orderHandler = Handler(handlerFunc: (context,params) {
    return OrderIndex();
  });
  
  static Handler _roomDetailsHandler = Handler(handlerFunc: (context,params) {
    return RoomDetails(params['roomId']?[0]);
  });

  static Handler _infoDetails = Handler(handlerFunc: (context,params) {
    return InfoDetails(params['pkid']![0]);
  });


  static void configRoutes(FluroRouter router) {
    router.define( home,handler: _homeHandler);
    router.define(login,handler: _loginHandler);
    router.define(register,handler: _registerHandler);
    router.define(my,handler: _myHandler);
    router.define(loading,handler: _loadingHandler);
    router.define(infoDetails,handler: _infoDetails);
    router.define(infoPage,handler: _infoHandler);
    router.define(projectEmployee,handler: _projectEmployeeHandler);
    router.define(add,handler: _addHandler);
    router.define(chat,handler: _chatHandler);
    router.define(roomDetails,handler: _roomDetailsHandler);
    router.define(order,handler: _orderHandler);
    router.notFoundHandler = _notFoundHandler;
  }


}